from selenium.webdriver import Keys
from selenium.webdriver.common.by import By

from tests.pages.web_page.base_page import BasePage


class LoginPage(BasePage):

    username_textbox = (By.XPATH, '//input[@type="text" and @placeholder="请输入用户名"] ') #手写的定位，简单的复制xpath实现不了功能
    password_textbox = (By.XPATH, '//input[@type="password" and @placeholder="请输入密码"] ')
    login_button =(By.XPATH, '//*[@id="app"]/div/div/form/div[3]/div/button[1]')
    reback_button = (By.XPATH, '//*[@id="app"]/div/div/form/div[3]/div/button[2]')
    assert_login_username_error = (By.XPATH,'//*[@id="app"]/div/div/form/div[1]/div/div[2]')
    assert_login_password_error = (By.XPATH,'//*[@id="app"]/div/div/form/div[2]/div/div[2]')


    def enter_username(self,text):
        self.enter_text(self.username_textbox,text)
    def enter_password(self,text):
        self.enter_text(self.password_textbox,text)
    def click_login_button(self):
        self.click_element(self.login_button)
    def click_reback_button(self):
        self.click_element(self.reback_button)



    #断言

